<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c"
           uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>老师注册</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%--    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/layui.css">--%>
    <link rel="stylesheet" href="/static/layui-v2.5.4/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/loginCss.css">
    <script src="${pageContext.request.contextPath}/static/layui.all.js"></script>
    <style type="text/css">
        .formdiv{
            padding:120px 500px;
        }
        /*解决Chrome下表单自动填充后背景色为黄色*/
        input:-webkit-autofill {
            -webkit-box-shadow: 0 0 0px 1000px white inset;
        }
        body {
            background-color: #FFDAB9;
        }
    </style>
</head>
<body>
<div class="formdiv">
    <form id="contact" action="<%=basePath%>teacherRegistCheck" method="post">
        <h3>选课系统注册</h3>
        <h4>老师选课注册 <a onclick="rule(this, event)" style="color: red">学号规则</a></h4>
        <h4 style="color:red;">${msg}</h4>
        <fieldset>
            <input placeholder="学号" type="text" name="userid" id="userid" tabindex="1" required autofocus>
        </fieldset>
        <fieldset>
            <input placeholder="姓名" type="text" name="username" id="username" tabindex="1" required autofocus>
        </fieldset>
        <fieldset>
            <input placeholder="密码" type="password" name="userpass" tabindex="2" required>
        </fieldset>
        <fieldset>
            <select name="insName" lay-verify="required">
                <option value="信息科学技术学院">信息科学技术学院</option>
                <option value="医学院">医学院</option>
                <option value="管理学院">管理学院</option>
                <option value="经济学院">经济学院</option>
            </select>
        </fieldset>
        <fieldset>
            <input name="sub" type="button" id="contact-submit" value="注册" />
        </fieldset>
    </form>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script>
        var isShowRule = 0;// 0 代表隐藏

        function rule(that, event) {
            if (isShowRule == 0) {
                console.log("enter rule")
                console.log(that)
                console.log(event)
                var pageX = event.pageX
                var pageY = event.pageY
                var div = document.createElement("div")
                div.id = "ruleDialog"
                div.style.color = "blue"
                div.style.backgroundColor = "rgba(255,218,185,0.5)"
                var text = "1.学号为10为数" + "<br>"
                // text = text + "2. 学生学号类似 20180*****" + "<br>"
                text = text + "2. 老师学号类似 20181*****"
                div.innerHTML = text
                console.log(that.parentElement.append(div))
                isShowRule = 1
            } else {
                var ruleDialog = document.getElementById("ruleDialog")
                ruleDialog.remove()
                isShowRule = 0
            }



        }

        $(function () {
            $("#contact-submit").click(function () {
                var testnum = /^\d{10}$/;
                var id=$("#userid").val();
                if (testnum.test(id)) {
                    $("#contact").submit();
                }
                else {
                    alert("请输入正确学号");
                }
                // $("#contact").submit();
            })

        })
    </script>
</div>


</body>
</html>
